# 栈: 先进后出,后进先出
'''
# list的底层维护了一个栈的线性表
# 栈
mystack = []
# 插入数据(压栈)
mystack.append(1)
print(mystack)
mystack.append(34)
print(mystack)
mystack.append(87)
print(mystack)

print("=======")

# 取出数据(出栈)
mystack.pop()
print(mystack)
mystack.pop()
print(mystack)
mystack.pop()
print(mystack)
'''

# 队列: 可以理解为水平放置的水管,  先进先出,后进后出
import collections
queue = collections.deque([12,34,56,78,98])
print(queue)

# 入队(向队列中添加数据)
queue.append(41)
print(queue)
queue.append(51)
print(queue)
queue.append(61)
print(queue)

print("*********")
# 出队(从队列中获取数据)
queue.popleft()
print(queue)
queue.popleft()
print(queue)
queue.popleft()
print(queue)
queue.popleft()
print(queue)
queue.popleft()
print(queue)
queue.popleft()
print(queue)
queue.popleft()
print(queue)
